/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package NicholasValueBeans;

import NicholasDatabase.SQLqueries;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ChuckToh
 */
public class Feedback {

    private int userId;
    private String remarks;
    private Date dateCreated;

    public Feedback() {
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public boolean insertIntoSQLTable() {
        boolean insertIntoSQLTableSuccessful = false;
        SQLqueries sql = new SQLqueries();
        try {
            int insertResults = sql.insertFeedback(userId, remarks, dateCreated);

            if (insertResults == 1) {
                insertIntoSQLTableSuccessful = true;
            }
        } catch (SQLException ex) {
            System.out.println(ex.getMessage());
        }
        sql.closeQuery();
        return insertIntoSQLTableSuccessful;
    }

    public ResultSet getAllFeedbacks() {
        SQLqueries sql = new SQLqueries();
        ResultSet allFeedbacksQuery = null;
        try {
            allFeedbacksQuery = sql.allFeedbacksQuery();
        } catch (SQLException ex) {
            System.out.println(ex.getMessage());
        }
        return allFeedbacksQuery;
    }
}
